function modalWin(config){
	var dom=window.top.document;
	var shade=dom.createElement("div");
	shade.className="shade";
	shade.style.width=dom.body.clientWidth+"px";
	shade.style.height=dom.body.clientHeight+"px";
	dom.body.appendChild(shade);
	
	var win=dom.createElement("div");
	win.className="modal_win"
	win.style.width=config.width+"px";
	win.style.height=config.height+"px";
	win.style.top=(dom.body.clientHeight-config.height)/2+"px";
	win.style.left=(dom.body.clientWidth-config.width)/2+"px";
	
	var top=dom.createElement("div");
	top.className="title_bar";
	top.style.height="24px";
	top.style.width=config.width+"px";
	
	var closeWin=function(){
		win.removeChild(iframe);
		//win.innerHTML="";
		dom.body.removeChild(shade);
		dom.body.removeChild(win);
	}
	
	var closeSpan=dom.createElement("span");
	closeSpan.onclick=closeWin;
	top.appendChild(closeSpan);			
	
	var iframe=dom.createElement("iframe");
	iframe.src=config.url;
	iframe.frameBorder=0;
	iframe.style.width=config.width;
	iframe.style.height=(config.height-48)+"px";
	
	
	var buttons=dom.createElement("div");
	buttons.className="button_bar";
	buttons.style.height="24px";
	buttons.style.width=config.width+"px";
	
	var createButton=function(btnCfg){
		var button=dom.createElement("input");
		button.type="button";
		button.value=btnCfg.value;
		var triggerClose=btnCfg.triggerClose||true;
		//input.style=button.style;
		//input.className=button.className;
		button.onclick=function(){
			if(btnCfg.click){
				btnCfg.click(iframe.contentWindow.document);
			}	
			if(triggerClose){
				closeWin();
			}
		};
		return button;		
	}
	for(var i=0;i<config.buttons.length;i++){
		var button=createButton(config.buttons[i]);
		button.className="submit";
		buttons.appendChild(button);
	}
	win.appendChild(top);
	win.appendChild(iframe);
	win.appendChild(buttons);
	dom.body.appendChild(win);
	$(win).dragDrop();
}